package com.pzhu.record.constants;

import org.springframework.core.convert.converter.Converter;

import java.text.SimpleDateFormat;
import java.util.Date;

//创建一个类型转换器类，实现Converter接口
public class DateConverter implements Converter<String, Date> {
    @Override
    public Date convert(String s) {

        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        try {
            return format.parse(s);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}